home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / macintosh / programmer-faq.part1 < prev    next >
Encoding:
Text File  |  1995-07-25  |  49.0 KB  |  1,304 lines

  1. Subject: Comp.Sys.Mac.Programmer FAQ Part 1/2 (1/12/93)
  2. Newsgroups: comp.sys.mac.programmer,news.answers
  3. From: Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer)
  4. Date: 31 Aug 1993 00:00:13 -0400
  5.  
  6. Archive-name: macintosh/programmer-faq/part1
  7. Last-modified: 1993/01/12
  8.  
  9.  
  10.                      +---------------------------------+
  11.                      | Frequently Asked Questions List |
  12.                      |   for Comp.Sys.Mac.Programmer   |
  13.                      |         January 12, 1993        |
  14.                      |            PART  ONE            |
  15.                      +---------------------------------+
  16.  
  17.  
  18. This FAQ list is automatically posted once a week to comp.sys.mac.programmer.
  19. It is also available via anonymous ftp from ftp.cs.uoregon.edu [128.223.8.8]
  20. (user name 'anonymous', your internet address as password) in the files
  21. /pub/mac/csmp-faq-1 and /pub/mac/csmp-faq-2.
  22.  
  23. This FAQ list is maintained by Daryl Spitzer.  He can be reached at the
  24. following addresses:
  25.  
  26.    Internet:  Daryl_Spitzer@mindlink.bc.ca
  27.    SnailMail: 203 - 1385 West 12th Avenue
  28.               Vancouver, BC  (Canada)
  29.               V6H 1M2
  30.  
  31. The purpose of the FAQ list is to answer some of the most common questions
  32. asked on this group, and to refer people left with unanswered questions to
  33. available sources of additional help.  You should read the FAQ list before
  34. posting to comp.sys.mac.programmer.
  35.  
  36. Submissions, comments, etcetera, should be sent to Daryl Spitzer, as above.
  37. All such material sent will be considered to have entered the public domain
  38. (and will be subject to editing) unless specific text to the contrary
  39. accompanies the message (which may render the submission unusable).
  40.  
  41.  
  42.  
  43.                          Changes since August 3, 1992
  44.                          ----------------------------
  45.  
  46.  - the keeper of the FAQ is now Daryl Spitzer (Daryl_Spitzer@mindlink.bc.ca)
  47.  
  48.  - 1.2  Debuggers:
  49.     added Fritz Anderson's description of SourceBug
  50.  
  51.  - 2.1  The Associates and Partners Programs:
  52.     new description, DEVHOTLINE is no longer a valid AppleLink address
  53.  
  54.  - 2.3  APDA
  55.     new address and telephone numbers
  56.  
  57.  - 3.1.1  Technical Books
  58.     new Inside Macintosh volumes
  59.  
  60.  - 3.1.3  Periodicals:
  61.     MacTutor is now MacTech
  62.  
  63.  
  64.  
  65.  
  66.                              Table of Contents
  67.                               -----------------
  68.  
  69. Part One  (this file)
  70. ---------------------
  71.  
  72.   I.    Development Software
  73.           1. Compilers
  74.           2. Debuggers
  75.           3. Other Tools
  76.  
  77.   II.   Apple Developer Programs
  78.           1. The Associates and Partners Programs
  79.           2. Apple Developer University
  80.           3. APDA
  81.           4. Developer CDs
  82.  
  83.   III.  Sources of Information
  84.           1. Books and Periodicals
  85.                1. Technical Books
  86.                2. Teaching Books
  87.                3. Periodicals
  88.           2. Mailing Lists
  89.                1. Comp.Sys.Mac.Programmer Digest
  90.                2. Think Class Library Discussion
  91.                3. MacPsych
  92.           3. Miscellaneous
  93.                1. Usenet Mac Programmer's Guide (UMPG)
  94.                2. Kent Sandvik's Frequently Asked MPW C++ and MacApp
  95. Questions
  96.                3. Comp.Sys.Mac.FAQ
  97.  
  98.   IV.   Archive Sites
  99.           1. ftp.apple.com [130.43.2.3]
  100.           2. sumex-aim.stanford.edu [36.44.0.6]
  101.           3. rascal.ics.utexas.edu [128.83.138.20]
  102.           4. mac.archive.umich.edu [141.211.164.153]
  103.           5. ftp.cs.uoregon.edu [128.223.8.8]
  104.           6. ics.uci.edu [128.195.1.1]
  105.           7. ftp.brown.edu [128.148.176.55]
  106.           8. comp.binaries.mac [newsgroup]
  107.  
  108.   V.    One-liners
  109.           1. The Main Loop and Events
  110.           2. Menus
  111.           3. Resources
  112.           4. Windows, Alerts, and Dialogs
  113.           5. Drawing
  114.           6. Files
  115.           7. Interrupts and VBL Tasks
  116.           8. Handles and Pointers
  117.           9. General
  118.  
  119.  
  120. Part Two  (separate file)
  121. -------------------------
  122.  
  123.   VI.   Specific Questions Answered
  124.           1. The Main Loop and Events
  125.                1. How do you tell if a specific key is being pressed?
  126.                2. How can I get millisecond timing from the keyboard
  127.                   (or mouse)?
  128.           2. Menus
  129.                1. When do you put an ellipsis on the end of a menu item?
  130.                2. How do I get the menubar to disappear and re-appear?
  131.                3. What's the difference between the resource ID of a 'MENU'
  132.                   resource and the menuID field of that resource?
  133.           3. Windows, Alerts, and Dialogs
  134.                1. How do you put a border around the default button in a
  135.                   dialog?
  136.           4. Drawing
  137.                1. What is the fastest way to paint one pixel on the screen?
  138.                2. How do you draw directly into a pixmap without using
  139.                   QuickDraw?
  140.                3. How do you draw directly onto the screen without using
  141.                   QuickDraw?
  142.                4. What RGB value does the system use for dimmed buttons,
  143.                   menus and window titles?
  144.           5. Files
  145.                1. Why is the File Manager so hard to use?
  146.                2. How do you get a full pathname?
  147.                3. How do you set the SFGet/PutFile directory?
  148.                4. How do you access the application's data fork?
  149.           6. Handles and Pointers
  150.                1. When should I call MoveHHi?
  151.                2. Why does malloc/calloc keep crashing or returning NULL in
  152.                   Think C?
  153.           7. Standalone Code
  154.                1. How do I write an INIT?
  155.           8. General
  156.                1. How do I register signatures and file types with Apple?
  157.                2. How do I go about writing serial port communications?
  158.  
  159.  
  160.   VII.  Eternal Debates:
  161.           1. Why doesn't the Mac do preemptive multitasking?
  162.  
  163.  
  164.  
  165. =============================================================================
  166.  
  167.  
  168.                      ===================================
  169.                        Section I: Development Software
  170.                      ===================================
  171.  
  172.  
  173. This is by no means a complete analysis of the tools, development systems,
  174. etc. that are available.  This is a short list of things which *most* Mac
  175. programmers use (or are at least aware of, and have considered using).
  176.  
  177.  
  178.  
  179. 1.1  Compilers
  180. --------------
  181.  
  182. Macintosh Programmer's Workshop (Apple)
  183. ---------------------------------------
  184.  
  185. MPW is a package which contains separately-purchaseable compilers for
  186. Assembly, C, C++, and Object Pascal.  All of these run in an environment
  187. called the MPW Shell.  The Shell is a command-line oriented environment,
  188. designed for extreme configurability with scripts, user-writeable "tools",
  189. i/o redirection, and lots of other bells and whistles.  On the pro side, it
  190. can do many things that THINK cannot do; it scales much better to large
  191. projects; it can be customized much more; and it's Apple's supported
  192. development environment.  On the con side, it is comparatively expensive,
  193. slow, and difficult to learn.  A debugger (SADE) is available for it, and
  194. is philosophically similar to MPW.  An object library is available (MacApp)
  195. which allows applications to be built on an object-oriented framework, again
  196. similar to MPW in it's approach of being very powerful, but not necessarily
  197. easy to learn, easy to use, small, or fast.
  198.  
  199. MPW is also available on the quarterly Essentials-Tools-Objects CD-ROM from
  200. Apple.  This disc contains the latest version of the entire MPW development
  201. environment, as well as debugging utilities and a huge collection of sample
  202. source code.  This brings the price of the MPW environment down a bit, but
  203. it's still much more expensive than THINK.
  204.  
  205.  
  206. Think (Symantec)
  207. ----------------
  208.  
  209. Think is two separate products, Think C and Think Object Pascal.  They are
  210. similar products.  Both are integrated editor/compiler/linker/debugger
  211. environments.  Both come with a large library of predefined classes (the C
  212. classes are written in a sort of pseudo C++ language that is Symantec's own
  213. Object C, not C++).  Think Pascal is MacApp-compatable, as well.  Both
  214. support inline assembly, but there is no separate assembler.  Their main
  215. selling point, however, is that they are very fast and very simple.  They are
  216. ideal for small projects that you want to finish in a few days, for
  217. beginners, and for people who need a full-fledged development environment but
  218. cannot afford MPW.  This is not to say that the Think environments are not
  219. useful for commercial development; many successful commercial programs were
  220. written with Think.  The difference in power between MPW and Think is only
  221. noticeable with very large and/or multiple-developer projects.
  222.  
  223.  
  224.  
  225. 1.2  Debuggers (beyond SADE and the Think debuggers)
  226. ----------------------------------------------------
  227.  
  228. MacsBug (Apple)
  229. ---------------
  230.  
  231. MacsBug is an assembly-level debugger.  It is a command-line driven, entirely
  232. text-based environment which uses little of the Mac toolbox, and is thus
  233. fairly stable in crashes (although it doesn't use protected memory, its main
  234. failing in the area of stability).  It supports complex operations with
  235. breakpoints, A-line traps, macros, expressions, and more, and can be
  236. configured even more with user-writeable 'dcmd' external code resources.
  237. MacsBug is free via anonymous ftp from ftp.apple.com.  It is also included
  238. with the book "Debugging Macintosh Software with MacsBug."
  239.  
  240.  
  241. TMON Professional (ICOM)
  242. ------------------------
  243.  
  244. TMON Professional is an object-level debugger which is MUCH more powerful
  245. than MacsBug.  It has an elaborate interface which looks nothing like a Mac
  246. application, and takes a while to get used to.  It is a very intelligent
  247. program, however, which can often display memory in its most useful format
  248. without help (e.g. it will disassemble code, and display a string as a
  249. string, automatically).  It has strong support for types, allowing you to
  250. easily view complex structures, arrays, floating point numbers, and more.
  251. You can examine the stack, the heaps, and just about anything else you could
  252. be interested in.  It also provides versatile scripting, and is amazingly
  253. configurable.  There are more goodies in this package than I can possible
  254. describe here.  Drawbacks are high price, and a very steep learning curve.
  255.  
  256.  
  257. The Debugger (Jasik Designs)
  258. ----------------------------
  259.  
  260. The Debugger (also known as Jasik's Debugger, because it was written by Steve
  261. Jasik) is the only source level debugger with all the low-level features of
  262. Macsbug (speed, straight-forward display of important info) and many of the
  263. advantages of source level debuggers (source code, quick display of local
  264. variables).  Some of its best features are complete support for Object
  265. Pascal, speed, and the ability to look at resource map and file information.
  266. You gotta love any debugger that will display all of the low-level globals
  267. with their values in a single keystroke!  It also has a On the down side,
  268. the interface is an aquired taste, the documentation needs work and
  269. distribution disks lack a certain polish.  But, phone support is very good
  270. (you often get Steve himself).
  271.  
  272.  
  273. SourceBug (Apple)
  274. -----------------
  275.  
  276. SourceBug is provided by Apple on its ETO development-tools CD.  Like SADE,
  277. SourceBug is a source-level debugger.  SADE is a scriptable,
  278. stream-in/stream-out environment like MPW: The code being debugged is
  279. displayed in text windows, with the current line highlighted.  Data
  280. structures
  281. can be inspected, but only through printing commands; the formatting is
  282. automatic and type-sensitive.  And, you can use scripts to walk linked or
  283. array data structures automatically, and save the results to text files.
  284.  
  285. SourceBug, by contrast, is driven by mouse selections and menu commands.  The
  286. program is centered around a browser window that organizes your code by
  287. source
  288. file (or by type, if you are using C++ or Object Pascal) and module name.
  289. You
  290. set breakpoints by clicking next to the line you want to break at.  SADE
  291. requires a command to set breakpoints (though a menu item front-ends a script
  292. to set simple ones by selection); on the other hand, a SADE breakpoint can
  293. execute any script, permitting snapshots and conditional breaks.  SourceBug
  294. gives you only an unconditional break.
  295.  
  296. The same dichotomy applies to data structures:  SourceBug is nearly as smart
  297. as SADE in parsing data, and provides you with an inspector for most
  298. instances
  299. of C++ or Pascal objects.  But finding data, link traversals, and some
  300. formatting are strictly manual jobs.  Variable-length arrays of complex
  301. types?
  302. Forget it.  SADE can handle them, SourceBug can't.
  303.  
  304. For most purposes, SourceBug is the better debugger.  It is rare that you
  305. need
  306. SADE's strengths badly enough to compose the suite of breakpoints and testing
  307. scripts you will need to make SADE effective.  SourceBug is better at 99% of
  308. the debugging tasks:  For instance, when you break into SourceBug, the
  309. currently-executing procedure is displayed in a window, with an arrow
  310. pointing
  311. to the current line.  In the upper part of the window is the stack crawl;
  312. click on any item in the list to see any procedure in the calling chain, see
  313. the line that made the call, and inspect (the optimizer permitting) the local
  314. variables of any procedure in the chain.  To do the same in SADE requires
  315. issuing a command to dump the stack and selecting a code address identifier
  316. in
  317. the result.  To examine a variable in use by a caller, you will have to use
  318. SADE's scoping language to provide it with enough context to identify the
  319. address.  SADE can do more, but it can't carry enough context to be as
  320. helpful
  321. as SourceBug.
  322.  
  323.  
  324.  
  325. 1.3  Other Tools
  326. ----------------
  327.  
  328. ResEdit (Apple)
  329. ---------------
  330.  
  331. ResEdit is the accepted tool for editing and creating resources.  It has very
  332. little competition, partially because it is a very good and comprehensive
  333. program, and partially because it is free (available via anonymous ftp from
  334. ftp.apple.com).  It allows you to edit any resource in hexadecimal, and most
  335. of the standard types have special editors that provide a direct-manipulation
  336. paradigm for editing them.  Users may write their own pickers and editors for
  337. custom resource types, although this is rarely done in practice.
  338.  
  339.  
  340. Resorcerer (Mathemaesthetics)
  341. ------------------------------
  342.  
  343. Resorcerer is a commercially available replacement for ResEdit.  Many
  344. developers use it exclusively, and swear by it quite vehemently.  This is
  345. from one of them:
  346.  
  347.       RESORCERER is a no-holds-barred resource dynamo.
  348.         -- embarrasses the ResEdit dialog editor
  349.         -- supports many more template data types
  350.         -- swap in different resource templates based on a key value
  351.         -- creates recursive resources
  352.         -- generates starter code for a dialog
  353.         -- does complex searches against resource contents or titles
  354.         -- renumbers resources in batches
  355.         -- changes resource types
  356.         -- excellent support from the author himself
  357.  
  358. I personally like Resorcerer for some things and ResEdit for others.  There
  359. are certain resource types that cannot be edited with Resorcerer, like
  360. color icons, and others that cannot be edited with ResEdit, like help
  361. balloons.  I expect, however, that with the addition of such resource
  362. editors to Resorcerer, I will begin to use it exclusively.
  363.  
  364. The price is the major consideration for most people.  ResEdit is free from
  365. Apple, while Resorcerer is a commercial product (available for around $250).
  366.  
  367.  
  368. Virtual User (Apple)
  369. --------------------
  370.  
  371. Virtual User allows you to script user interactions with a program so that
  372. they cal be relayed over and over, and it can execute scripts remotely, over
  373. AppleTalk.  So, for instance, you could write a script that puts your program
  374. through its paces, and then automatically execute that script simultaneously
  375. on lots of differently configured Macintosh systems.  It is available from
  376. APDA (#M0987LL/B).  [This paragraph taken from develop Issue 8, page 60.]
  377.  
  378.  
  379. Online Companion (Addison-Wesley)
  380. ---------------------------------
  381.  
  382. Online Companion is a reference tool.  Hit a magic key combination, and a
  383. pseudo-window opens at the bottom of the screen which allows you to type in
  384. a full or partial name and find it in Online's database.  It contains Inside
  385. Mac and some supplements, Tech Notes, etc.  It's fast and simple.
  386.  
  387.  
  388. Think Reference (Symantec)
  389. --------------------------
  390.  
  391. Think Reference is a reference tool.  It is a hypertext version of Inside Mac
  392. I-V and the Tech Notes.  Click on the function or data type name to go to the
  393. page on which it is defined.  It includes some very useful notes and examples
  394. written by Symantec, and the function prototypes can be copied and pasted
  395. into your editor.  Very fast and simple to use.  But beware of typos and, in
  396. some cases, bad advice.
  397.  
  398.  
  399.  
  400.  
  401.  
  402.                    ========================================
  403.                      Section II: Apple Developer Programs
  404.                    ========================================
  405.  
  406.  
  407. 2.1  The Associates and Partners Programs
  408. -----------------------------------------
  409.  
  410. From the Macintosh Development Tools and Languages Guidebook
  411. (1993 Edition, page 15):
  412.  
  413. The Apple Associates Program is Apple's mainstream program for qualified
  414. commercial developers whose plans are well-aligned to Apple's long-term
  415. strategy.  Members of this program receive essential technical and
  416. marketing information, as well as self-help technical support tools.
  417. Eligible Apple Associates can also purchase, at special prices, a limited
  418. number of Apple systems for development purposes.
  419.  
  420. The Apple Partners Program is a development support program for
  421. Apple-selected commercial developers.  Apple Partners haves access to
  422. programs and services such as techical and marketing information, as well
  423. as direct technical support via electronic mail.  Apple Partners can also
  424. purchase, at special prices, a limited number of Apple computer systems
  425. for development purposes.
  426.  
  427. Apple Associates and Apple Partners receive a monthly mailing containing
  428. all of the information in the Technical Information Mailing.  [see section
  429. 2.4]  Two other particularly interesting products that are included are
  430. the Developer CD, which contains hundreds of megabytes of
  431. programming-related material, and Apple Direct, a newspaper that keeps
  432. developers abreast of Apple's technical developments and marketing
  433. directions.
  434.  
  435. Apple Associates and Apple Partners also get product-level support on
  436. development tools and system software, and information on how to use
  437. Apple's resources most efficiently.  Additionally, code-level support
  438. from Developer Technical Support is available to Apple Partners via
  439. electronic mail.
  440.  
  441. For more information on support programs for commercial developers
  442. contact the Developer Hotline at:
  443.  
  444. Developer Support
  445. Apple Computer Inc.
  446. 20525 Mariani Avenue, M/S 75-2C
  447. Cupertino, CA 95014
  448. (408) 974-4897
  449.  
  450. [no AppleLink address is given, but try DEVSUPPORT]
  451.  
  452.  
  453. 2.2  Apple Developer University
  454. -------------------------------
  455.  
  456. From the back cover of 'develop' Issue 7:
  457.  
  458. Apple Developer University provides training for all levels of Macintosh
  459. programmers.  The hands-on classes give you experience using the most up-
  460. to-date development tools.  Classes are offered in locations across the
  461. United States, and on-site instruction can also be arranged.  Multimedia
  462. self-paced courses are available from Developer University through APDA.
  463. These courses include Macintosh Programming Fundamentals, User-Centered
  464. Design, and Introduction to Object-Oriented Programming.
  465.  
  466. The registrar at (408) 974-6215 can reserve your place or send a current
  467. catalog.  You can also AppleLink DEVUNIV (devuniv@applelink.apple.com) or
  468. write
  469.  
  470.      20525 Mariani Avenue
  471.      M/S 75-6U
  472.      Cupertino, CA  95014
  473.  
  474.  
  475. 2.3  APDA
  476. ---------
  477.  
  478. From the Macintosh Development Tools and Languages Guidebook
  479. (1993 Edition, page 13):
  480.  
  481. APDA is an Apple service organization that offers convenient worldwide
  482. access to over 300 development tools, resources, training products, and
  483. information for anyone interested in developing applications on Apple
  484. platforms.  Customers receive the quarterly APDA Tools Catalog featuring
  485. alll of the most popular and most current versions of Apple tools and the
  486. most popular third-party development tools.  Ordering is easy, there are
  487. no membership fees and no special agreements are required for most products.
  488. APDA offers convenient payment and shipping options, including site
  489. licensing.
  490.  
  491. To order product or receive a complimentary APDA Tools Catalog, contact:
  492.  
  493.     APDA
  494.     Apple Computer Inc.
  495.     P.O. Box 319
  496.     Buffalo, New York 14207-0319 U.S.
  497.  
  498.     (800) 282-2732 U.S.
  499.     (800) 637-0029 Canada
  500.     (716) 871-6555 International
  501.     (716) 871-6511 Fax
  502.     APDA           AppleLink (apda@applelink.apple.com)
  503.     76666,2405     CompuServe
  504.     APDA           America Online
  505.  
  506.  
  507. 2.4  Developer CDs
  508. ------------------
  509.  
  510. The developer CDs are available quarterly from APDA, or monthly to Apple
  511. Associates and Partners.  The quarterly version is also included in the
  512. quarterly issue of d e v e l o p.  They contain just about everything that
  513. Apple makes freely available, including SpInside Mac, the Tech Notes, and
  514. a plethora of code snippets.
  515.  
  516.  
  517.  
  518.  
  519.  
  520.                    =======================================
  521.                      Section III: Sources of Information
  522.                    =======================================
  523.  
  524.  
  525. 3.1  Books and Periodicals
  526. --------------------------
  527.  
  528. 3.1.1  Technical Books
  529. ----------------------
  530.  
  531.  
  532. Inside Macintosh Volume I
  533.    Addison-Wesley.  ISBN 0-201-17731-5.  $24.95
  534. Inside Macintosh Volume II
  535.    Addison-Wesley.  ISBN 0-201-17732-3.  $24.95
  536. Inside Macintosh Volume III
  537.    Addison-Wesley.  ISBN 0-201-17733-1.  $19.95
  538. Inside Macintosh Volume IV
  539.    Addison-Wesley.  ISBN 0-201-05409-4.  $24.95
  540. Inside Macintosh Volume V
  541.    Addison-Wesley.  ISBN 0-201-17719-6.  $26.95
  542. Inside Macintosh Volume VI
  543.    Addison-Wesley.  ISBN 0-201-57755-0.  $39.95
  544.  
  545.      Inside Mac is the definitive reference regarding the Macintosh toolbox.
  546.      Volumes I and II are basically essential to any Mac programmer who uses
  547.      the toolbox at all.  Volume III is essentially a summary, cross
  548.      reference, index-y sort of thing, and isn't very useful.  Volume IV is
  549.      stuff specific to the Mac Plus and later machines, which would make it
  550.      almost as important as I and II (not many 512K Macs left out there),
  551.      except that the routines it describes are not nearly as generally
  552.      useful.  It does have all of the stuff on the HFS File Manager, however,
  553.      so if you're working with File Manager routines you should definitely
  554.      consult IV before I-III.  Otherwise, you can survive without it for a
  555.      while.  Volume V is the Mac II volume.  It has every thing on Color
  556.      QuickDraw, as well as lots of other goodies.  I'd say it's more useful
  557.      than IV, but only if you're doing color.  Volume VI is the System 7
  558.      volume.  It contains all kinds of bizarre new things which are probably
  559.      not of general use or interest; but it contains a lot of new
  560.      non-System-7 stuff as well (such as 32-bit Quickdraw), and it has
  561.      corrections to the other five volumes.
  562.  
  563.  
  564. Inside Macintosh X-Ref, Revised Edition
  565.    Addison Wesley.  ISBN 0-201-57769-0.  $12.95.
  566.  
  567.      Inside Mac X-Ref is a cross-referenced index to the six volumes and
  568.      some other Macintosh technical books.
  569.  
  570.  
  571. Inside Macintosh: Files      ISBN 0-201-63244-6     $29.95
  572. Inside Macintosh: Memory     ISBN 0-201-63240-3     $24.95
  573. Inside Macintosh: Processes  ISBN 0-201-63241-1     $22.95
  574.  
  575.      Inside Macintosh, having previously been three authoritative
  576.      volumes, with three chronological supplements, has been due for
  577.      a rewrite and overhaul for a few years.  Apple is now in the
  578.      process of reissuing IM in 15 subject-related books, of which
  579.      only the first three have come out at this writing.
  580.  
  581.      If you have volumes I-VI, then you will eventually have to buy
  582.      the new Inside Macintosh, too.  Newcomers are in a dilemma:
  583.      The new IM has better information than the old one, but not
  584.      enough of the new IM has come out to be useful.  They will have
  585.      to judge how urgent their need is for authoritative
  586.      information.  Dabblers and beginners can probably get by with
  587.      the teaching books recommended below.  Serious work begins with
  588.      Volume I (basic ToolBox), Volume II (basic OS), and Volume IV
  589.      (for the file system).  If you need color, get Volume V; if you
  590.      do anything with processes (IPC, backgrounding), get Volume VI.
  591.  
  592.  
  593. M68000 User's Manual
  594.    Prentice Hall.  ISBN 0-13-609249-7.  $22.95.
  595. MC68020 User's Manual
  596.    Prentice Hall.  ISBN 0-13-567017-9.  $22.95.
  597. MC68030 User's Manual
  598.    Prentice Hall.  ISBN 0-13-566423-3.  $22.95.
  599. MC68881/MC68882 Floating-Point Coprocessor User's Manual
  600.    Prentice Hall.  ISBN 0-13-566936-7.  $22.95.
  601.  
  602.      The Motorola references are required reading for anyone doing assembly
  603.      programming on the Mac.  The 68000 is by far the most important.  The
  604.      68881 manual only has relevance to those who want to do floating point
  605.      and don't want to use SANE (the Standard Apple Numeric Environment,
  606.      slow but robust, precise and general).
  607.  
  608.  
  609. Technical Introduction to the Macintosh Family
  610.    Addison-Wesley.  ISBN 0-201-17765-X.  $19.95.
  611.  
  612.      This book provides an overview of the general hardware design, system
  613.      archiecture, and ROM design of the Macintosh.  It is not required for
  614.      programming, but does provide some useful background information for
  615.      programmers new to the Mac.
  616.  
  617.  
  618. Programmer's Introduction to the Macintosh Family.
  619.    Addison-Wesley.  ISBN 0-201-19254-3.  $22.95.
  620.  
  621.      This book provides an overview of basic Macintosh programming concepts.
  622.      It is recommended for programmers new to the Mac.
  623.  
  624.  
  625. Guide to the Macintosh Family Hardware
  626.    Addison-Wesley.  ISBN 0-201-52405-8.  $26.95.
  627.  
  628.      This is the definitive guide to the hardware design of the Macintosh
  629.      family.
  630.  
  631.  
  632. Designing Cards and Drivers for the Macintosh Family
  633.    Addison-Wesley.  ISBN 0-201-52404-X.  $26.95.
  634.  
  635.      This is the official guide for developers of expansion cards and
  636.      peripheral devices for the Mac.  This book is required reading for
  637.      anyone who wants to talk directly to expansion cards (video cards,
  638.      for example).
  639.  
  640.  
  641. Human Interface Guidelines: The Apple Desktop Interface
  642.    Addison-Wesley.  ISBN 0-201-17753-6.  $14.95.
  643.  
  644.      This is the definitive guide to program interface design on the
  645.      Macintosh.  When you find yourself wondering where to put the OK
  646.      button in a dialog, consult this book.
  647.  
  648.  
  649. Apple Numerics Manual
  650.    Addison-Wesley.  ISBN 0-201-17738-2.  $29.95.
  651.  
  652.      This book describes the Standard Apple Numerics Environment (SANE),
  653.      and provides information about the IEEE-standard arithmetic and
  654.      about the SANE engines on the Apple IIgs and Macintosh computers.
  655.  
  656.  
  657. Inside the Macintosh Communications Toolbox
  658.    Addison-Wesley.  ISBN 0-201-57775-5.  $24.95.
  659.  
  660.      This is the definitive reference volume for the Communications Toolbox.
  661.  
  662.  
  663.  
  664. 3.1.2  Teaching Books
  665. ---------------------
  666.  
  667.  
  668. Macintosh Programming Primer (Second Edition)
  669.    Addison-Wesley.  ISBN 0-201-60838-3.  $26.95.
  670. Macintosh C Programming Primer Volume II
  671.    Addison-Wesley.  ISBN 0-201-57016-5.  $24.95.
  672.  
  673.      These are excellent books for the beginning Mac programmer.  Both books
  674.      use Think C in their examples, but developers using other platforms
  675.      will find a plethora of useful tidbits.  I believe both books are
  676.      available in Pascal as well.
  677.  
  678.  
  679. Macintosh Revealed, Volume One: Unlocking the Toolbox
  680.    Hayden Books.  ISBN 0-8104-6551-5.  $26.95.
  681. Macintosh Revealed, Volume Two: Programming with the Toolbox
  682.    Hayden Books.  ISBN 0-8104-6561-2.  $26.95.
  683. Macintosh Revealed, Volume Three: Mastering the Toolbox
  684.    Hayden Books.  ISBN 0-672-48402-1.  $26.95.
  685. Macintosh Revealed, Volume Four: Expanding the Toolbox
  686.    Hayden Books.  ISBN 0-672-48413-7.  $26.95.
  687.  
  688.      This encyclopedic collection covers the entire Mac Toolbox for the
  689.      beginning Pascal or Assembly programmer.  It sometimes re-iterates
  690.      Inside Mac, but always offers a fresh perspective.  Volume I covers
  691.      basics including memory management and QuickDraw.  Volume II covers the
  692.      other essential Toolbox managers and exemplifies each by constructing
  693.      part of a complete text editor.  Volume III expands this application,
  694.      covering printing, drivers, desk accessories, sound and definition
  695.      functions.  Volume IV contains details of programming with MultiFinder,
  696.      Color QuickDraw and styled text.
  697.  
  698.  
  699. How to Write Macintosh Software (Third Edition)
  700.    Hayden Books.  ISBN 0-201-?????-?.  ~$30.
  701.  
  702.      This book gives comprehensive coverage of memory management and
  703.      debugging techniques.  It also gives an excellent overview of assembly
  704.      language programming on the Mac.  A must-have.  Somebody please send me
  705.      the ISBN and price of the third edition (I haven't bought mine yet).
  706.  
  707.  
  708. Macintosh Programming Secrets (Second Edition)
  709.    Addison-Wesley.  ISBN 0-201-58134-5.  $29.95.
  710.  
  711.      This is the second edition of Scott Knaster's classic book.  This
  712.      edition was co-authored by Keith Rollin.  From the back cover: "If
  713.      you've ever written Macintosh programs, or want to learn how it's done,
  714.      this book will show you how to perform tasks that aren't explicitly
  715.      documented in the reference books."  This is true.  Get this book if
  716.      you want to learn how to write a tail patch, or how to hide the menu
  717.      bar.  If you don't know what a tail patch is, that's OK; this book
  718.      starts at (or near) the beginning.  A must-have for all beginning- and
  719.      intermediate-level Macintosh programmers.
  720.  
  721.  
  722. On Macintosh Programming: Advanced Techniques
  723.    Addison-Wesley.  ISBN 0-201-51737-X.  $24.95.
  724.  
  725.      This book contains a lot of information on all aspects of programming
  726.      the Mac, including hardware and software architecture, the toolbox,
  727.      and the use of assembly, C, and Pascal for programming the toolbox.
  728.      It includes quite a lot of source code.
  729.  
  730.  
  731. Using the Macintosh Toolbox With C
  732.    Sybex.  ISBN 0-89588-572-7.  $29.95.
  733.  
  734.      This is a fairly good book for beginning Mac programmers.  Experienced
  735.      programmers will find nothing new here.
  736.  
  737.  
  738. Programmer's Guide to MPW, Volume I
  739.    Addison-Wesley.  ISBN 0-201-57011-4.  $26.95.
  740.  
  741.      This is a basic introduction to using MPW.  I don't recommend it for
  742.      anyone who already uses MPW.
  743.  
  744.  
  745. Programming with MacApp
  746.    Addison-Wesley.  ISBN 0-201-09784-2.  $24.95.
  747. C++ Programming with MacApp
  748.    Addison-Wesley.  ISBN 0-201-57020-3.  $24.95.
  749.  
  750.      These give a basic introduction to programming with MacApp; the first
  751.      with Object Pascal, and the second with C++.
  752.  
  753.  
  754. Programming for System 7.
  755.    Addison-Wesley.  ISBN 0-201-56770-9.  $26.95
  756.  
  757.      This is a guide to creating applications for System 7.  It describes
  758.      the new features and functions of the operating system in detail.
  759.      The sample code is in C and includes a complete System 7 application
  760.      in Chapter 1 which is expanded in succeeding chapters.
  761.  
  762.  
  763. ResEdit Complete
  764.    Addison-Wesley.  ISBN 0-201-55075-X.  $29.95.
  765.  
  766.      Most of this book is not written for programmers, but includes quite
  767.      a bit of useful information nonetheless.  It contains detailed
  768.      discussions of using, customizing and programming ResEdit, including
  769.      the creation of custom templates, pickers and editors. It comes with
  770.      ResEdit 2.1 on disk, with sample source code in MPW C and Pascal.
  771.  
  772.  
  773. Debugging Macintosh Software with MacsBug
  774.    Addison-Wesley.  ISBN 0-201-57049-1.  $34.95.
  775.  
  776.      This looks like a really good and useful book, but I haven't had a
  777.      chance to look at it yet.  MacsBug is included on disk, along with
  778.      several examples and dcmds.
  779.  
  780.  
  781. Programming the M68000
  782.    Benjamin/Cummings.  ISBN 0-8053-5550-2.
  783. 680x0 Programming by Example
  784.    Howard W. Sams & Co.  ISBN 0-672-22544-1.  $17.95.
  785. M68000 Assembly Language: Techniques for Building Programs
  786.    Addison-Wesley.  ISBN 0-201-11659-6.
  787. The Complete Book of Macintosh Assembly Language Programming [sic]
  788.    Scott, Foresman & Co.
  789.    Vol I  ISBN 0-673-18379-3
  790.    Vol II ISBN 0-673-18583-4
  791.  
  792.      These are all assembly books that have been recommended by people on
  793.      the net.  The first two are general; the others are specific to the
  794.      Macintosh.
  795.  
  796.  
  797.  
  798. 3.1.3  Periodicals
  799. ------------------
  800.  
  801.  
  802. d e v e l o p
  803.    Quarterly.  $10 per issue.  $30 per year.
  804.    develop
  805.    Apple Computer, Inc.
  806.    P.O. Box 531
  807.    Mt. Morris, IL  61054
  808.    AppleLink DEV.SUBS
  809.  
  810.      develop is Apple's technical journal for the Macintosh and Apple II
  811.      (the focus is on the Mac).  The articles are well-written and useful,
  812.      and it includes the Developer CD.
  813.  
  814.  
  815. MacTech  (was MacTutor)
  816.    Monthly.  $5 per issue.  $40 per year Third Class; $55 First Class.
  817.     Xplain Corporation
  818.     P.O. Box 250055
  819.     Los Angeles, CA  90025-9555
  820.     Phone: (310) 575-4343
  821.       FAX: (310) 575-0925
  822.     mactutor@applelink.apple.com
  823.  
  824.      The only Macintosh programming journal that I'm aware of.  A good
  825.      source of sample code.
  826.  
  827.  
  828.  
  829.  
  830. 3.2  Mailing Lists
  831. ------------------
  832.  
  833. 3.2.1  Comp.Sys.Mac.Programmer Digest
  834. -------------------------------------
  835.  
  836. The Comp.Sys.Mac.Programmer Digest is a collection of article threads from
  837. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  838. regularly and want an archive of the discussions.
  839.  
  840. Each issue of the digest contains one or more sets of articles (called
  841. threads), with each set corresponding to a 'discussion' of a particular
  842. subject.  The articles are not edited; all articles included in the digest
  843. are in their original posted form (as received by the news server at
  844. cs.uoregon.edu).  Article threads are not added to the digest until the last
  845. article added to the thread is at least one month old (this is to ensure that
  846. the thread is dead before adding it to the digest).  Article threads that
  847. consist of only one message are generally not included in the digest.
  848.  
  849. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  850. [128.223.8.8] in the directory /pub/mac/csmp-digest.  The most recent issues
  851. are available from sumex-aim.stanford.edu [36.44.0.6] in the directory
  852. /info-mac/digest/csmp.  If you don't have ftp capability, the sumex archive
  853. has a mail server; send a message with the text '$MACarch help' (no quotes)
  854. to LISTSERV@ricevm1.rice.edu for more information.
  855.  
  856. The digest is also available via email.  Just send a note saying that you
  857. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  858. automatically receive each new issue as it is created.  Sorry, back issues
  859. are not available through the mailing list.
  860.  
  861.  
  862.  
  863.  
  864. 3.2.2  Think Class Library Discussion
  865. -------------------------------------
  866.  
  867. The Think Class Library discussion list is for those interested in using
  868. Symantec's Think C and Think Pascal object-oriented class library for
  869. Macintosh.  Discussion topics include
  870.  
  871.    * class usage, design, and implementation
  872.    * TCL bug reports, work-arounds, and fixes
  873.    * TCL application development techniques
  874.    * TCL development aids
  875.  
  876. Mail to the discussion list should be sent to tcl-talk@brown.edu.
  877. If you want to join the discussion list, mail a note saying so to
  878. tcl-request@brown.edu.
  879.  
  880.  
  881.  
  882.  
  883. 3.2.3  MacPsych
  884. ---------------
  885.  
  886. This is a mailing list of psychologists and others interested in using the
  887. Macintosh in research and teaching.  The intention of this service is to
  888. provide quick and authoritative answers to questions raised by Mac-using
  889. researchers and teachers in psychology.  Individuals who have Mac questions
  890. to pose, or have general messages that they believe would be of interest to
  891. research psychologists and teachers using the Macintosh, may send their
  892. information to macpsych@stolaf.edu.  Mail sent to this address will first
  893. pass through the moderator for the list (huff@stolaf.edu) who will forward
  894. it to everyone on the list.
  895.  
  896. If you want to be on the mailing list, mail a note saying so to
  897. macpsych-request@stolaf.edu.
  898.  
  899. There is an archive containing some free Macintosh software that has been
  900. written by members of the group; for more information, write to
  901. macpsych-request@stolaf.edu.
  902.  
  903.  
  904.  
  905.  
  906. 3.3  Miscellaneous
  907. ------------------
  908.  
  909. 3.3.1  Usenet Mac Programmer's Guide
  910. ------------------------------------
  911.  
  912. The Usenet Mac Programmer's Guide (UMPG) is a collection of useful tips
  913. culled  from comp.sys.mac.programmer.  Compiled by Matthew X. Mora
  914. (mxmora@unix.sri.com), it is organized by topic and includes a table of
  915. contents and index.  It is available via anonymous ftp from sumex-aim.
  916. stanford.edu (36.44.0.6) in the directory /info-mac/tech/.
  917.  
  918. It is also available in a pre-printed version, or on disk.
  919.  
  920. To get a copy of the printed version send $17.00 to:
  921.  
  922.      USENET Macintosh Programmer's Guide Printed Version
  923.      39075 Carmel Ct.
  924.      Fremont, CA  94538
  925.  
  926. To get a copy of the disk version send $5.00 to:
  927.  
  928.       USENET Macintosh Programmer's Guide Disk Version
  929.       39075 Carmel Ct.
  930.       Fremont, CA  94538
  931.  
  932.  
  933.  
  934.  
  935. 3.3.2  Kent Sandvik's Frequently Asked MPW C++ and MacApp Questions
  936. -------------------------------------------------------------------
  937.  
  938. This file is available upon request from ksand@apple.com or via anonymous ftp
  939. to ftp.cs.uoregon.edu [128.223.8.8] in the directory /pub/mac.
  940.  
  941.  
  942.  
  943.  
  944. 3.3.3  Comp.Sys.Mac.FAQ
  945. -----------------------
  946.  
  947. This Frequently Asked Questions list provides short answers to a number of
  948. frequently asked questions from the newsgroups comp.sys.mac.system,
  949. comp.sys.mac.misc, and comp.sys.mac.apps.  Some of the questions that it
  950. answers are asked occasionally on comp.sys.mac.programmer.  Please read
  951. this FAQ list before posting to c.s.m.p.  It is available from the sumex
  952. archives and its mirror sites (see section 4.2) in the file /info-mac/
  953. report/csmf-faq.txt.
  954.  
  955.  
  956.  
  957.  
  958.  
  959.                         =============================
  960.                           Section IV: Archive Sites
  961.                         =============================
  962.  
  963.  
  964. 4.1  ftp.apple.com [130.43.2.3]
  965. -------------------------------
  966.  
  967. Contents
  968.    This archive contains just about everything available for free from
  969.    Apple.  Look here first for sample source code, the latest tech
  970.    notes, and tools such as ResEdit and MacsBug.  Very little of what
  971.    can be found here is available from other archives.
  972.  
  973. Access
  974.    Anonymous ftp, from inside the United States only.
  975.    You should read the file /dts/README.FIRST before downloading from this
  976.    archive.  Everything for the Mac is in /dts/mac.  The moderators ask that
  977.    you download during the off-peak hours if at all possible, since this is
  978.    just a IIci running A/UX.
  979.  
  980. Submissions
  981.    You cannot post to this archive.
  982.  
  983.  
  984. 4.2  sumex-aim.stanford.edu [36.44.0.6]
  985. ---------------------------------------
  986.  
  987. Contents
  988.    This archive contains a large collection of public-domain and shareware
  989.    for the Mac.  It is well-maintained and updated regularly.  New
  990.    submissions to the archive are listed every other day or so in the
  991.    newsgroup comp.sys.mac.digest.
  992.  
  993. Access
  994.    Anonymous ftp.  Read the files in /info-mac/help for more detailed
  995.    information about the files in the archive.  Everything is in /info-mac.
  996.    If you don't have ftp access you can use the mail server; send a message
  997.    with the text '$MACarch help' (no quotes) to LISTSERV@ricevm1.rice.edu
  998.    for more information.
  999.  
  1000. Submissions
  1001.    Sumex accepts all submissions that "are of general benefit to the
  1002.    Macintosh community."  Basically, if you have something that you think is
  1003.    useful, and that other people may like to have, you should feel free to
  1004.    send it to sumex.  All submissions should be compressed and BinHexed, and
  1005.    should include a short but informative blurb at the beginning of the file.
  1006.    Mail your submissions to info-mac@sumex-aim.stanford.edu.  For more
  1007.    detailed information, consult the file
  1008.        /info-mac/help/posting-guidelines.txt.
  1009.  
  1010.  
  1011. 4.3  rascal.ics.utexas.edu [128.83.138.20]
  1012. ------------------------------------------
  1013.  
  1014. This archive is being discontinued as of 5/92.  It will continue to have
  1015. stuff available for a while, perhaps a few months, but the contents will
  1016. eventually dwindle until there is very little or nothing left.
  1017.  
  1018. Contents
  1019.    This archive contains most of what can be found at sumex.  Its
  1020.    emphasis is on utilities and programming-related items, but it
  1021.    contains quite a bit of other stuff as well.  It is the home of
  1022.    the comp.sys.mac.announce archives.  Many items tend to appear
  1023.    here before they show up at sumex or comp.binaries.mac.
  1024.  
  1025. Access
  1026.    Anonymous ftp.
  1027.  
  1028. Submissions
  1029.    No longer accepted.
  1030.  
  1031.  
  1032. 4.4  mac.archive.umich.edu [141.211.164.153]
  1033. --------------------------------------------
  1034.  
  1035. Contents
  1036.    I haven't explored this archive yet, but I hear it has quite a bit
  1037.    of general Macintosh freeware and shareware.
  1038.  
  1039. Access
  1040.    Anonymous ftp.
  1041.  
  1042. Submissions
  1043.    You can submit to this archive by mailing a compressed, binhexed
  1044.    file with a brief descriptive header to macgifts@mac.archive.umich.
  1045.    edu.  This address will also forward your mail to comp.binaries.mac
  1046.    and sumex-aim.stanford.edu.
  1047.  
  1048.  
  1049. 4.5  ftp.cs.uoregon.edu [128.223.8.8]
  1050. -------------------------------------
  1051.  
  1052. Contents
  1053.    This is the home of this FAQ list, as well as the Comp.Sys.Mac.
  1054.    Programmer Digests.  There's also a little sample code not included
  1055.    in the FAQ.
  1056.  
  1057. Access
  1058.    Anonymous ftp.  Directory /pub/mac.
  1059.  
  1060. Submissions
  1061.    Not accepted.
  1062.  
  1063.  
  1064. 4.6  ics.uci.edu [128.195.1.1]
  1065. ------------------------------
  1066.  
  1067. Contents
  1068.    This archive has some Mac stuff, although not nearly as much as the
  1069.    major sites, such as sumex.  The main attraction is the Think C
  1070.    directory.  It contains the latest updates to Think C, as well as
  1071.    Think C related system extensions, fkeys, etc., and source code.
  1072.    Definitely worth checking out if you use Think C extensively.
  1073.  
  1074. Access
  1075.    Anonymous ftp.  Directory /mac.
  1076.  
  1077. Submissions
  1078.    Not accepted, I think.  Someone please correct me if I'm wrong.
  1079.  
  1080.  
  1081. 4.7  ftp.brown.edu [128.148.176.55]
  1082. -----------------------------------
  1083.  
  1084. Contents
  1085.    This is the home of the Think Class Library mailing list.  It includes
  1086.    TCL bug fixes and new classes, as well as an archive of the tcl-talk
  1087.    mailing list.
  1088.  
  1089. Access
  1090.    Anonymous ftp.  Directory /pub/tcl.
  1091.  
  1092. Submissions
  1093.    Submissions to the archive should be mailed to tcl-request@brown.edu or
  1094.    placed in the directory /incoming/tcl with accompanying mail to
  1095.    tcl-request.  Encode all submissions in BinHex 4.0 format and include a
  1096.    descriptive header.  Please do not redistribute Symantec's TCL source.
  1097.  
  1098.  
  1099. 4.8  comp.binaries.mac [newsgroup]
  1100. ----------------------------------
  1101.  
  1102. Contents
  1103.    This is a moderated newsgroup for distribution of Macintosh freeware
  1104.    and shareware.  Just about everything that gets sent to sumex and
  1105.    the other major archives gets sent here as well.
  1106.  
  1107. Access
  1108.    Subscribe to the newsgroup....
  1109.  
  1110. Submissions
  1111.    All files should be compressed and binhexed for mailing.  Posting
  1112.    to the newsgroup should automatically get your file mailed to the
  1113.    moderator.  If this does not happen on your system, you can mail
  1114.    your posting to the moderator yourself at macintosh@dhw68k.cts.com,
  1115.    or at dhw68k!bytebug@ics.uci.edu if the first address doesn't work.
  1116.    Expect a delay of as much as a month before your posting shows up
  1117.    on the newsgroup.
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.                           =========================
  1124.                             Section V: One-liners
  1125.                           =========================
  1126.  
  1127.  
  1128. 5.1  The Main Loop and Events
  1129. -----------------------------
  1130.  
  1131. Call MaxApplZone and MoreMasters when the application starts up.
  1132. If you call SetApplLimit, do it before calling MaxApplZone.
  1133. Use HD in MacsBug while running to estimate how many times to call
  1134. MoreMasters.
  1135. Don't use SetEventMask to disable mouseUp events.  Better not to use it at
  1136. all.
  1137. Call WaitNextEvent if you're running under System 6 or later.
  1138. DTS sample code passes 0x7fffffff to WaitNextEvent when nothing is happening.
  1139. DTS sample code passes GetCaretTime() to WaitNextEvent when flashing a
  1140. cursor.
  1141. Call both GetNextEvent and SystemTask only if WaitNextEvent is unavailable.
  1142. Call IsDialogEvents and DialogSelect even if GetNextEvent returns false.
  1143. SetPort to a known good grafPort once every time through the event loop.
  1144. Set the cursor on suspend and resume events.
  1145. Call GetDblTime to get the maximum time for a double click.
  1146. Measure double click time from mouse up to mouse down.
  1147.  
  1148.  
  1149. 5.2  Menus
  1150. ----------
  1151.  
  1152. Use SetItem to include meta characters literally in menus.
  1153. Prepend an ASCII 0 to a menu item to use a leading '-'.
  1154. Never make MENU resources purgeable.
  1155.  
  1156.  
  1157. 5.3  Resources
  1158. --------------
  1159.  
  1160. GetResource never produces resNotFound.  Check for a NIL handle instead.
  1161. To create a resource file, call HCreate, then HCreateResFile.
  1162. To open a resource file read-only for shared access, use HOpenResFile.
  1163. Don't leave ResLoad set to false.
  1164. GetResource on a dctb may return a non-resource copy of the dctb.
  1165.  
  1166.  
  1167. 5.4  Windows, Alerts, and Dialogs
  1168. ---------------------------------
  1169.  
  1170. Move and size windows to the bounding box of GetGrayRgn.
  1171. Hide scroll bars when deactivating a window.
  1172. Call DrawGrowIcon when activating or deactivating a window with a grow
  1173. region.
  1174. DrawGrowIcon does not check to see if the window has a grow region.
  1175. Call PenNormal before calling DrawGrowIcon.
  1176. itemHit will not be set when a dialog filter is called.
  1177. Use a disabled UserItem to draw the roundrect outline around the OK button.
  1178. ModalDialog assumes the dialog is already visible and in the front.
  1179. Use screenBits.bounds to center dialogs, alerts, etc. below the menu bar.
  1180. If you save window locations in files, they may not be valid for all
  1181. monitors.
  1182. DragWindow expects startPt in boundsRect; if not it may not call
  1183. SelectWindow.
  1184. SelectWindow does not automatically call SetPort.  You must do that yourself.
  1185. DialogSelect responds to activate events but ignores suspend/resume events.
  1186.  
  1187.  
  1188. 5.5  Drawing
  1189. ------------
  1190.  
  1191. Always set the VisRgn and ClipRgn of offscreen ports.
  1192. Set the ClipRgn first when making a picture.
  1193. Don't make rowBytes in bitMaps greater than 8191.
  1194. To dim text, draw a rectangle with penPat=gray and penMode=patbic over it.
  1195. To draw rotated text, draw to an offscreen bitmap, rotate it, and CopyBits
  1196. it.
  1197. Don't use picSize to determine the size of a picture.  Check the handle size.
  1198. Never draw outside a window except in XOR mode for temporary effects like
  1199. drag.
  1200. To avoid animation flicker, synchronize drawing to the vertical retrace.
  1201. CopyBits on more than 3Kb data will work, but it might have to allocate
  1202. memory.
  1203. The small Mac screen is 512 pixels wide by 342 pixels high including menu
  1204. bar.
  1205.  
  1206.  
  1207. 5.6  Files
  1208. ----------
  1209.  
  1210. Don't write in the application file.  This will fail with read-only devices.
  1211. Use PBGetVInfo to convert a VRefNum to a volume name.
  1212. Delete uses the Poor Man's Search Path, so don't delete blindly.
  1213. File Manager routines with dirID=0 use the Poor Man's Search Path.
  1214. Truncate and reallocate files before overwriting to reduce fragmentation.
  1215. Check/change the creator and type of Save As... files before overwriting.
  1216. If you rewrite files by deleting and creating, copy all Finder information.
  1217. Directory ID's are longs, not shorts.  Shorts work ALMOST all the time.
  1218. Always set the version number that appears in some file manager calls to 0.
  1219. To convert a pathRefNum to a name or file number, use PBGetFCBInfo.
  1220. Prevent the creation of files with names that begin with a period.
  1221.  
  1222.  
  1223. 5.7  Interrupts and VBL Tasks
  1224. -----------------------------
  1225.  
  1226. Don't call any Memory Manager routines during an interrupt.
  1227. Unlocked handles may not be valid during an interrupt.
  1228. To synchronize to the vertical retrace on Macs with slots use SlotVInstall.
  1229.  
  1230.  
  1231. 5.8  Handles and Pointers
  1232. -------------------------
  1233.  
  1234. Lock handles before passing their dereferenced pointers to any routine.
  1235. Lock handles before setting referenced data to expressions containing
  1236. functions
  1237. Put an odd long at location zero on a 68000 to help find NIL handle
  1238. references.
  1239. Use HGetState/HLock/HSetState to lock a handle then put it back as it was.
  1240.  
  1241.  
  1242. 5.9  General
  1243.  
  1244. Always use unsigned characters within text and Pascal-format strings.
  1245. Save application preferences in a folder named Preferences in the System
  1246. Folder
  1247. Use SysEnvirons to find the System (Blessed) Folder.
  1248. Use GetAppParms to get the name of the application.
  1249. The high bit of SysParam . volClik enables the alarm clock.
  1250. Check the application name at $910 before exiting with ES within MacsBug.
  1251. To exit to shell in the mini-debugger, enter SM 0 A9 F4 and then G 0.
  1252. In Pascal, don't nest procedures to be passed by procedure pointer.
  1253. In Pascal, "with theHandle^^" is unsafe if memory compaction can occur.
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.                        ==============================
  1260.                          Credits / Acknowledgements
  1261.                        ==============================
  1262.  
  1263.  
  1264. Many thanks to Ben Haller, who started this whole thing, and did quite a lot
  1265. of work on this posting before handing it off to Michael A. Kelly.  Many
  1266. thanks to Michael A. Kelly also, for all his work in establishing and
  1267. maintaining this FAQ (in addition to continuing to keep the
  1268. Comp.Sys.Mac.Programmer Digest) before passing the baton.
  1269.  
  1270. Thanks to these people for proofreading this list during its development:
  1271.     Ben Haller
  1272.     Wally Wedel
  1273.     John B. Matthews
  1274.     Patrick Beard
  1275.     Steve Zellers
  1276.  
  1277. Thanks to Chris Webster for the one-liners.
  1278.  
  1279. Thanks to Peter Lewis for the answers to the following specific questions:
  1280.     6.2.1  When do you put an ellipsis on the end of a menu item?
  1281.     6.5.1  Why is the File Manager so hard to use?
  1282.     6.5.2  How do you get a full pathname?
  1283.     6.5.3  How do you set the SFGet/PutFile directory?
  1284.  
  1285. Thanks to Greg Ferrar for the review on TMON Pro.
  1286.  
  1287. Thanks to John Rinaldo for the review on Jasik's Debugger.
  1288.  
  1289. Thanks for Fritz Anderson for his descriptions of SourceBug and the new
  1290. Inside Macintosh volumes.
  1291.  
  1292. And thanks to everyone who has offered suggestions or constructive
  1293. criticism....  Keep those comments coming!
  1294.  
  1295.  
  1296.  
  1297.  
  1298. --
  1299. -------------------------------------------------------------------
  1300.  Daryl_Spitzer@mindlink.bc.ca     "Life isn't just, life just is."
  1301.          a2251@mindlink.bc.ca              -- Me  (I think.)
  1302. -------------------------------------------------------------------
  1303.  
  1304.